High-pressure and high-temperature reference electrodes are widely used for corrosion control and electrochemical studies [see D. D. Macdonald, “Reference Electrodes for High Temperature Aqueous Systems—A Review and Assessment,” Corrosion, Vol. 34, page 75-84, 1978, and C. M. Menendez, “Reference Electrodes For High Pressure And High Temperature Electrochemical Testing,” CORROSION/2001, paper, 01305, (Houston, Tex.: NACE International, 2001)]. This invention is related to a method for eliminating the formation of gas bubbles inside a reference or a pH electrode tube filled with a liquid. Such gas bubbles formed inside the tube in the liquid section often affect the electrical continuity between the top and bottom ends of an electrode.